Repository navigation
fix: auto-start WS server in-process and change default port to 20132 - #6072
Conversation
left a comment
There was a problem hiding this comment.
Code Review
This pull request updates the default live WebSocket port from 20129 to 20132 across the codebase, switches the configuration from a disable flag to an enable flag (OMNIROUTE_ENABLE_LIVE_WS), and introduces a utility to dynamically derive the WebSocket path from the public URL. Feedback on the changes suggests using the standard URL API instead of String.prototype.replace() in src/hooks/useLiveDashboard.ts to safely update the WebSocket URL's pathname and prevent potential string replacement bugs.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
6c5b845 to
8ff61c3
Compare
commented
Jul 6, 2026
|
🔀 Cycle moved: base retargeted to |
commented
Jul 6, 2026
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Update the default WebSocket port for the live dashboard server from 20129 to 20132 across all configuration files, documentation, code comments, and tests. Also consolidate OMNIROUTE_DISABLE_LIVE_WS and OMNIROUTE_ENABLE_LIVE_WS into a single OMNIROUTE_ENABLE_LIVE_WS flag. Wire the live WebSocket server to start in-process via instrumentation-node.ts.
…grade path from URL Update .env.example and ENVIRONMENT.md to document that the pathname portion of NEXT_PUBLIC_LIVE_WS_PUBLIC_URL (e.g. /live-ws) is used as the WebSocket upgrade path by the dev proxy, handshake response, and client connection logic. Extract deriveLiveWsPath() into shared/utils/wsPath.ts and wire it through: - src/app/api/v1/ws/route.ts — handshake response path field - src/hooks/useLiveDashboard.ts — build
…rigins Add LIVE_WS_PORT (20132), LIVE_WS_HOST (0.0.0.0), and LIVE_WS_ALLOWED_ORIGINS environment variables to all Docker Compose profiles and expose the WebSocket port mapping. Prevent infinite self-loop in standalone-server-ws.mjs by skipping proxy when the server itself is running on the LiveWS port.
919e49c to
f7aa89e
Compare
The fork predates diegosouzapw#6324 (EADDRINUSE crash-loop guard). Merging restores the wss.once("error", reject) handler in startLiveDashboardServer() alongside this PR's auto-start-in-process changes — both are complementary and needed together. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
commented
Jul 11, 2026
|
@ianriizky thanks for the in-process WS auto-start (+ default port 20132) — merged into release/v3.8.47. 🙏 |
commented
Jul 11, 2026
I really appreciate man. I'll look up for another issue you need to solve 🤝. |
Summary
await import("@/server/ws/liveServer")inside the isBackgroundServicesDisabled() guard. No longer requires a separate sidecar script across all deployment modes (dev, production, Docker, Electron).20129to20132to avoid port conflict withAPI_PORT(20129) in split-port mode configurations.OMNIROUTE_DISABLE_LIVE_WSenvironment variable. Consolidated toOMNIROUTE_ENABLE_LIVE_WS(default: enabled) across all code, scripts, and documentation.LIVE_WS_PORTto docker-compose.yml (env only, no port mapping).NEXT_PUBLIC_LIVE_WS_PUBLIC_URLinstead of being hardcoded to/live-ws. The path is extracted from the URL (e.g.wss://ws.my-ai.com/my-ws→/my-ws), with/live-wsas fallback. Shared via src/shared/utils/wsPath.ts and used by the handshake response, client hook, and dev proxy.Related Issues
Validation
npm run typecheck:corenpm run test:unit(24 existing tests + 1 new regression test — all passed)node --import tsx/esm --test tests/unit/live-ws-public-url.test.ts(7 tests — 5 existing + 2 new path derivation tests — all passed)npm run test:coverage>= 60%for statements, lines, functions, and branchesTests Added Or Updated
@/server/ws/liveServerfor in-process auto-start.20129→20132.20129→20132.20129→20132, and 2 new test cases for path derivation fromNEXT_PUBLIC_LIVE_WS_PUBLIC_URLpathname (custom path + default fallback).Coverage Notes
liveServerimport is present.body.live.path.Reviewer Notes
LIVE_WS_PORT=20129in their .env are unaffected (env var overrides the default). Operators relying on the default need to update firewall/proxy rules from 20129 to 20132.OMNIROUTE_DISABLE_LIVE_WSwas removed from .env.example, .env, docs/reference/ENVIRONMENT.md, and scripts/start-ws-server.mjs. Operators usingOMNIROUTE_DISABLE_LIVE_WS=1should migrate toOMNIROUTE_ENABLE_LIVE_WS=0.LIVE_WS_PORTadded to thex-commonanchor and theomniroute-hostprofile environment. No port mapping added — the WS server binds to loopback inside the container.try/catch(non-fatal) inside the isBackgroundServicesDisabled() block, so a WS server failure won't crash the application startup.NEXT_PUBLIC_LIVE_WS_PUBLIC_URLat runtime (server-side) and at build time (client-side). Onlyws:///wss://URLs are accepted for path extraction; non-ws URLs fall back to/live-ws. In Docker prebuilt scenarios where the env var is set at runtime but wasn't available at build time, the client discovers the path via the handshake responsebody.live.path.startsWith("/live-ws")check in standalone-server-ws.mjs was changed tostartsWith(LIVE_WS_PATH + "/")to avoid false positives (e.g./live-ws-custommatching/live-ws).